const tokens = {
    admin: {
        token: 'admin-token',
    },
}

const users = {
    'admin-token': {
        roles: ['admin'],
        introduction: 'I am a super administrator',
        avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
        name: 'Super Admin',
    },
}

module.exports = [
    // user login
    {
        url: '/vue-admin-template/user/login',
        type: 'post',
        response: config => {
            const { username } = config.body
            const token = tokens[username]

            if (!token) {
                return {
                    code: 60204,
                    message: 'Account and password are incorrect.',
                }
            }
            return {
                code: 200,
                data: token,
            }
        },
    },
    // user logout
    {
        url: '/vue-element-admin/user/logout',
        type: 'post',
        response: _ => {
            return {
                code: 200,
                data: 'success',
            }
        },
    },
]
